home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / bash_completion.d / lvm < prev    next >
Encoding:
Text File  |  2010-11-16  |  23.3 KB  |  1,095 lines

  1. # bash completion for lvm
  2.  
  3. have lvm && {
  4. _volumegroups()
  5. {
  6.     COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \
  7.         sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- "$cur" ) )
  8. }
  9.  
  10. _physicalvolumes()
  11. {
  12.     COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \
  13.         sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- "$cur" ) )
  14. }
  15.  
  16. _logicalvolumes()
  17. {
  18.     COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \
  19.         sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- "$cur" ) )
  20. }
  21.  
  22. _units()
  23. {
  24.     COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- "$cur" ) )
  25. }
  26.  
  27. _sizes()
  28. {
  29.     COMPREPLY=( $( compgen -W 'k K m M g G t T' -- "$cur" ) )
  30. }
  31.  
  32. _args()
  33. {
  34.     args=0
  35.     if [[ "${COMP_WORDS[0]}" == lvm ]]; then
  36.         offset=2
  37.     else
  38.         offset=1
  39.     fi
  40.     for (( i=$offset; i < COMP_CWORD; i++ )); do
  41.         if [[ "${COMP_WORDS[i]}" != -* ]]; then
  42.             args=$(($args + 1))
  43.         fi
  44.     done
  45. }
  46.  
  47. _lvmdiskscan()
  48. {
  49.     local cur
  50.  
  51.     COMPREPLY=()
  52.     _get_comp_words_by_ref cur
  53.  
  54.     if [[ "$cur" == -* ]]; then
  55.         COMPREPLY=( $( compgen -W '--debug --help \
  56.             --lvmpartition --verbose --version' -- "$cur" ) )
  57.     fi
  58. }
  59. complete -F _lvmdiskscan lvmdiskscan
  60.  
  61. _pvscan()
  62. {
  63.     local cur
  64.  
  65.     COMPREPLY=()
  66.     _get_comp_words_by_ref cur
  67.  
  68.     if [[ "$cur" == -* ]]; then
  69.         COMPREPLY=( $( compgen -W '--debug --exported --novolumegroup \
  70.             --help --ignorelockingfailure --partial --short --uuid \
  71.             --verbose --version' -- "$cur" ) )
  72.     fi
  73. }
  74. complete -F _pvscan pvscan
  75.  
  76. _pvs()
  77. {
  78.     local cur prev
  79.  
  80.     COMPREPLY=()
  81.     _get_comp_words_by_ref cur prev
  82.  
  83.     case $prev in
  84.         -o|-O|--options|--sort)
  85.             COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid \
  86.                 pv_size pv_free pv_used pv_name \
  87.                 pv_attr pv_pe_count \
  88.                 pv_pe_alloc_count' -- "$cur" ) )
  89.             return 0
  90.             ;;
  91.         --units)
  92.             _units
  93.             return 0
  94.             ;;
  95.     esac
  96.  
  97.     if [[ "$cur" == -* ]]; then
  98.         COMPREPLY=( $( compgen -W '--aligned --all --debug \
  99.             --help --ignorelockingfailure --noheadings \
  100.             --nosuffix --options --sort --separator --unbuffered --units \
  101.             --verbose --version' -- "$cur" ) )
  102.     else
  103.         _physicalvolumes
  104.     fi
  105. }
  106. complete -F _pvs pvs
  107.  
  108. _pvdisplay()
  109. {
  110.     local cur prev
  111.  
  112.     COMPREPLY=()
  113.     _get_comp_words_by_ref cur prev
  114.  
  115.     case $prev in
  116.         --units)
  117.             _units
  118.             return 0
  119.             ;;
  120.     esac
  121.  
  122.     if [[ "$cur" == -* ]]; then
  123.         COMPREPLY=( $( compgen -W '--colon --columns --units \
  124.             --verbose --debug --help --version' -- "$cur" ) )
  125.     else
  126.         _physicalvolumes
  127.     fi
  128. }
  129. complete -F _pvdisplay pvdisplay
  130.  
  131. _pvchange()
  132. {
  133.     local cur prev
  134.  
  135.     COMPREPLY=()
  136.     _get_comp_words_by_ref cur prev
  137.  
  138.     case $prev in
  139.         -A|-x|--autobackup|--allocatable)
  140.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  141.             return 0
  142.             ;;
  143.     esac
  144.  
  145.     if [[ "$cur" == -* ]]; then
  146.         COMPREPLY=( $( compgen -W '--all --autobackup \
  147.             --debug --help --test --uuid \
  148.             --allocatable --verbose --addtag --deltag \
  149.             --version' -- "$cur" ) )
  150.     else
  151.         _physicalvolumes
  152.     fi
  153. }
  154. complete -F _pvchange pvchange
  155.  
  156. _pvcreate()
  157. {
  158.     local cur prev
  159.  
  160.     COMPREPLY=()
  161.     _get_comp_words_by_ref cur prev
  162.  
  163.     case $prev in
  164.         --restorefile)
  165.             _filedir
  166.             return 0
  167.             ;;
  168.         -M|--metadatatype)
  169.             COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
  170.             return 0
  171.             ;;
  172.         --metadatacopies)
  173.             COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) )
  174.             return 0
  175.             ;;
  176.         --metadatasize|--setphysicalvolumesize)
  177.             _sizes
  178.             return 0
  179.             ;;
  180.     esac
  181.  
  182.     if [[ "$cur" == -* ]]; then
  183.         COMPREPLY=( $( compgen -W '--restorefile --debug \
  184.             --force --help --labelsector --metadatatype \
  185.             --metadatacopies --metadatasize \
  186.             --setphysicalvolumesize --test --uuid \
  187.             --verbose --yes --version' -- "$cur" ) )
  188.     else
  189.         _physicalvolumes
  190.     fi
  191. }
  192. complete -F _pvcreate pvcreate
  193.  
  194. _pvmove()
  195. {
  196.     local cur prev
  197.  
  198.     COMPREPLY=()
  199.     _get_comp_words_by_ref cur prev
  200.  
  201.     case $prev in
  202.         -A|--autobackup)
  203.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  204.             return 0
  205.             ;;
  206.         -n|--name)
  207.             _logicalvolumes
  208.             return 0
  209.     esac
  210.  
  211.     if [[ "$cur" == -* ]]; then
  212.         COMPREPLY=( $( compgen -W '--abort --autobackup \
  213.             --background --debug --force --help --interval --test --verbose \
  214.             --version --name' -- "$cur" ) )
  215.     else
  216.         _physicalvolumes
  217.     fi
  218. }
  219. complete -F _pvmove pvmove
  220.  
  221. _pvremove()
  222. {
  223.     local cur
  224.  
  225.     COMPREPLY=()
  226.     _get_comp_words_by_ref cur
  227.  
  228.     if [[ "$cur" == -* ]]; then
  229.         COMPREPLY=( $( compgen -W '--debug --force \
  230.             --help --yes --test --verbose --version' -- "$cur" ) )
  231.     else
  232.         _physicalvolumes
  233.     fi
  234. }
  235. complete -F _pvremove pvremove
  236.  
  237. _vgscan()
  238. {
  239.     local cur
  240.  
  241.     COMPREPLY=()
  242.     _get_comp_words_by_ref cur
  243.  
  244.     if [[ "$cur" == -* ]]; then
  245.         COMPREPLY=( $( compgen -W '--debug --help \
  246.             --ignorelockingfailure --mknodes \
  247.             --partial --verbose --version' -- "$cur" ) )
  248.     fi
  249. }
  250. complete -F _vgscan vgscan
  251.  
  252. _vgs()
  253. {
  254.     local cur prev
  255.  
  256.     COMPREPLY=()
  257.     _get_comp_words_by_ref cur prev
  258.  
  259.     case $prev in
  260.         -o|-O|--options|--sort)
  261.             COMPREPLY=( $( compgen -W 'vg_fmt vg_uuid vg_name \
  262.                 vg_attr vg_size vg_free vg_sysid \
  263.                 vg_extent_size vg_extent_count vg_free_count \
  264.                 max_lv max_pv pv_count lv_count snap_count \
  265.                 vg_seqno' -- "$cur" ) )
  266.             return 0
  267.             ;;
  268.         --units)
  269.             _units
  270.             return 0
  271.             ;;
  272.     esac
  273.  
  274.     if [[ "$cur" == -* ]]; then
  275.         COMPREPLY=( $( compgen -W '--aligned --debug \
  276.             --help --ignorelockingfailure --noheadings \
  277.             --nosuffix --options --sort --partial \
  278.             --separator --unbuffered --units \
  279.             --verbose --version' -- "$cur" ) )
  280.     else
  281.         _volumegroups
  282.     fi
  283. }
  284. complete -F _vgs vgs
  285.  
  286. _vgdisplay()
  287. {
  288.     local cur prev
  289.  
  290.     COMPREPLY=()
  291.     _get_comp_words_by_ref cur prev
  292.  
  293.     case $prev in
  294.         --units)
  295.             _units
  296.             return 0
  297.             ;;
  298.     esac
  299.  
  300.     if [[ "$cur" == -* ]]; then
  301.         COMPREPLY=( $( compgen -W '--colon --columns --units \
  302.             --partial --activevolumegroups --verbose \
  303.             --debug --help --version' -- "$cur" ) )
  304.     else
  305.         _volumegroups
  306.     fi
  307. }
  308. complete -F _vgdisplay vgdisplay
  309.  
  310. _vgchange()
  311. {
  312.     local cur prev
  313.  
  314.     COMPREPLY=()
  315.     _get_comp_words_by_ref cur prev
  316.  
  317.     case $prev in
  318.         -a|-A|-x|--available|--autobackup|--resizeable)
  319.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  320.             return 0
  321.             ;;
  322.     esac
  323.  
  324.     if [[ "$cur" == -* ]]; then
  325.         COMPREPLY=( $( compgen -W '--autobackup --alloc \
  326.             --partial --debug --help --ignorelockingfailure \
  327.             --test --uuid --verbose --version \
  328.             --available --resizeable --logicalvolume \
  329.             --addtag --deltag' -- "$cur" ) )
  330.     else
  331.         _volumegroups
  332.     fi
  333. }
  334. complete -F _vgchange vgchange
  335.  
  336. _vgcreate()
  337. {
  338.     local cur prev
  339.  
  340.     COMPREPLY=()
  341.     _get_comp_words_by_ref cur prev
  342.  
  343.     case $prev in
  344.         -A|--autobackup)
  345.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  346.             return 0
  347.             ;;
  348.         -M|--metadatatype)
  349.             COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
  350.             return 0
  351.             ;;
  352.         -s|--physicalextentsize)
  353.             _sizes
  354.             return 0
  355.             ;;
  356.     esac
  357.  
  358.     if [[ "$cur" == -* ]]; then
  359.         COMPREPLY=( $( compgen -W '--autobackup --addtag --alloc \
  360.             --debug --help --maxlogicalvolumes --metadatatype \
  361.             --maxphysicalvolumes --physicalextentsize --test \
  362.             --verbose --version' -- "$cur" ) )
  363.     else
  364.         _args
  365.         if [ $args -eq 0 ]; then
  366.             _volumegroups
  367.         else
  368.             _physicalvolumes
  369.         fi
  370.     fi
  371. }
  372. complete -F _vgcreate vgcreate
  373.  
  374. _vgremove()
  375. {
  376.     local cur
  377.  
  378.     COMPREPLY=()
  379.     _get_comp_words_by_ref cur
  380.  
  381.     if [[ "$cur" == -* ]]; then
  382.         COMPREPLY=( $( compgen -W '--debug --help --test \
  383.             --verbose --version' -- "$cur" ) )
  384.     else
  385.         _volumegroups
  386.     fi
  387. }
  388. complete -F _vgremove vgremove
  389.  
  390. _vgrename()
  391. {
  392.     local cur prev
  393.  
  394.     COMPREPLY=()
  395.     _get_comp_words_by_ref cur prev
  396.  
  397.     case $prev in
  398.         -A|--autobackup)
  399.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  400.             return 0
  401.             ;;
  402.     esac
  403.  
  404.     if [[ "$cur" == -* ]]; then
  405.         COMPREPLY=( $( compgen -W '--autobackup --debug \
  406.             --help --test --verbose --version' -- "$cur" ) )
  407.     else
  408.         _volumegroups
  409.     fi
  410. }
  411. complete -F _vgrename vgrename
  412.  
  413. _vgreduce()
  414. {
  415.     local cur prev
  416.  
  417.     COMPREPLY=()
  418.     _get_comp_words_by_ref cur prev
  419.  
  420.     case $prev in
  421.         -A|--autobackup)
  422.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  423.             return 0
  424.             ;;
  425.     esac
  426.  
  427.     if [[ "$cur" == -* ]]; then
  428.         COMPREPLY=( $( compgen -W '--all --autobackup \
  429.             --debug --help --removemissing --test \
  430.             --verbose --version' -- "$cur" ) )
  431.  
  432.     else
  433.         _args
  434.         if [ $args -eq 0 ]; then
  435.             _volumegroups
  436.         else
  437.             _physicalvolumes
  438.         fi
  439.     fi
  440. }
  441. complete -F _vgreduce vgreduce
  442.  
  443. _vgextend()
  444. {
  445.     local cur prev
  446.  
  447.     COMPREPLY=()
  448.     _get_comp_words_by_ref cur prev
  449.  
  450.     case $prev in
  451.         -A|--autobackup)
  452.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  453.             return 0
  454.             ;;
  455.         -L|--size)
  456.             _sizes
  457.             return 0
  458.             ;;
  459.     esac
  460.  
  461.     if [[ "$cur" == -* ]]; then
  462.         COMPREPLY=( $( compgen -W '--autobackup --debug \
  463.             --help --test --verbose --version' -- "$cur" ) )
  464.     else
  465.         _args
  466.         if [ $args -eq 0 ]; then
  467.             _volumegroups
  468.         else
  469.             _physicalvolumes
  470.         fi
  471.     fi
  472. }
  473. complete -F _vgextend vgextend
  474.  
  475. _vgport()
  476. {
  477.     local cur prev
  478.  
  479.     COMPREPLY=()
  480.     _get_comp_words_by_ref cur
  481.  
  482.     if [[ "$cur" == -* ]]; then
  483.         COMPREPLY=( $( compgen -W '--all --debug \
  484.             --help --verbose --version' -- "$cur" ) )
  485.     else
  486.         _volumegroups
  487.     fi
  488. }
  489. complete -F _vgport vgimport vgexport
  490.  
  491. _vgck()
  492. {
  493.     local cur
  494.  
  495.     COMPREPLY=()
  496.     _get_comp_words_by_ref cur
  497.  
  498.     if [[ "$cur" == -* ]]; then
  499.         COMPREPLY=( $( compgen -W '--debug \
  500.             --help --verbose --version' -- "$cur" ) )
  501.     else
  502.         _volumegroups
  503.     fi
  504. }
  505. complete -F _vgck vgck
  506.  
  507. _vgconvert()
  508. {
  509.     local cur prev
  510.  
  511.     COMPREPLY=()
  512.     _get_comp_words_by_ref cur prev
  513.  
  514.     case $prev in
  515.         -M|--metadatatype)
  516.             COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
  517.             return 0
  518.             ;;
  519.         --metadatacopies)
  520.             COMPREPLY=( $( compgen -W '0 1 2' -- "$cur" ) )
  521.             return 0
  522.             ;;
  523.         --metadatasize)
  524.             _sizes
  525.             return 0
  526.             ;;
  527.     esac
  528.  
  529.     if [[ "$cur" == -* ]]; then
  530.         COMPREPLY=( $( compgen -W '--debug --help --labelsector \
  531.             --metadatatype --metadatacopies --metadatasize \
  532.             --test --verbose --version' -- "$cur" ) )
  533.     else
  534.         _volumegroups
  535.     fi
  536. }
  537. complete -F _vgconvert vgconvert
  538.  
  539. _vgcfgbackup()
  540. {
  541.     local cur prev
  542.  
  543.     COMPREPLY=()
  544.     _get_comp_words_by_ref cur prev
  545.  
  546.     case $prev in
  547.         -f|--file)
  548.             _filedir
  549.             return 0
  550.             ;;
  551.     esac
  552.  
  553.     if [[ "$cur" == -* ]]; then
  554.         COMPREPLY=( $( compgen -W '--debug --file --help \
  555.             --ignorelockingfailure --partial --verbose \
  556.             --version' -- "$cur" ) )
  557.     else
  558.         _volumegroups
  559.     fi
  560. }
  561. complete -F _vgcfgbackup vgcfgbackup
  562.  
  563. _vgcfgrestore()
  564. {
  565.     local cur prev
  566.  
  567.     COMPREPLY=()
  568.     _get_comp_words_by_ref cur prev
  569.  
  570.     case $prev in
  571.         -f|--file)
  572.             _filedir
  573.             return 0
  574.             ;;
  575.         -M|--metadatatype)
  576.             COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
  577.             return 0
  578.             ;;
  579.         -n|--name)
  580.             _volumegroups
  581.             return 0
  582.             ;;
  583.     esac
  584.  
  585.     if [[ "$cur" == -* ]]; then
  586.         COMPREPLY=( $( compgen -W '--debug --file --list \
  587.             --help --metadatatype --name --test \
  588.             --verbose --version' -- "$cur" ) )
  589.     else
  590.         _volumegroups
  591.     fi
  592. }
  593. complete -F _vgcfgrestore vgcfgrestore
  594.  
  595. _vgmerge()
  596. {
  597.     local cur prev
  598.  
  599.     COMPREPLY=()
  600.     _get_comp_words_by_ref cur prev
  601.  
  602.     case $prev in
  603.         -A|--autobackup)
  604.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  605.             return 0
  606.             ;;
  607.     esac
  608.  
  609.     if [[ "$cur" == -* ]]; then
  610.         COMPREPLY=( $( compgen -W '--autobackup --debug --help \
  611.             --list --test --verbose --version' -- "$cur" ) )
  612.     else
  613.         _volumegroups
  614.     fi
  615. }
  616. complete -F _vgmerge vgmerge
  617.  
  618. _vgsplit()
  619. {
  620.     local cur prev
  621.  
  622.     COMPREPLY=()
  623.     _get_comp_words_by_ref cur prev
  624.  
  625.     case $prev in
  626.         -A|--autobackup)
  627.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  628.             return 0
  629.             ;;
  630.         -M|--metadatatype)
  631.             COMPREPLY=( $( compgen -W '1 2' -- "$cur" ) )
  632.             return 0
  633.             ;;
  634.     esac
  635.  
  636.     if [[ "$cur" == -* ]]; then
  637.         COMPREPLY=( $( compgen -W '--autobackup --debug \
  638.             --help --list --metadatatype --test \
  639.             --verbose --version' -- "$cur" ) )
  640.     else
  641.         _args
  642.         if [[ $args -eq 0 || $args -eq 1 ]]; then
  643.             _volumegroups
  644.         else
  645.             _physicalvolumes
  646.         fi
  647.     fi
  648. }
  649. complete -F _vgsplit vgsplit
  650.  
  651. _vgmknodes()
  652. {
  653.     local cur
  654.  
  655.     COMPREPLY=()
  656.     _get_comp_words_by_ref cur
  657.  
  658.     if [[ "$cur" == -* ]]; then
  659.         COMPREPLY=( $( compgen -W '--debug --help --verbose \
  660.             --version' -- "$cur" ) )
  661.     else
  662.         _volumegroups
  663.     fi
  664. }
  665. complete -F _vgmknodes vgmknodes
  666.  
  667. _lvscan()
  668. {
  669.     local cur
  670.  
  671.     COMPREPLY=()
  672.     _get_comp_words_by_ref cur
  673.  
  674.     if [[ "$cur" == -* ]]; then
  675.         COMPREPLY=( $( compgen -W '--blockdevice --debug \
  676.             --help --ignorelockingfailure \
  677.             --partial --verbose --version' -- "$cur" ) )
  678.     fi
  679. }
  680. complete -F _lvscan lvscan
  681.  
  682. _lvs()
  683. {
  684.     local cur prev
  685.  
  686.     COMPREPLY=()
  687.     _get_comp_words_by_ref cur prev
  688.  
  689.     case $prev in
  690.         -o|-O|--options|--sort)
  691.             COMPREPLY=( $( compgen -W 'lv_uuid lv_name lv_attr lv_minor \
  692.                 lv_size seg_count origin snap_percent segtype stripes \
  693.                 stripesize chunksize seg_start seg_size' -- "$cur" ) )
  694.             return 0
  695.             ;;
  696.         --units)
  697.             _units
  698.             return 0
  699.             ;;
  700.     esac
  701.  
  702.     if [[ "$cur" == -* ]]; then
  703.         COMPREPLY=( $( compgen -W '--aligned --debug --help \
  704.             --ignorelockingfailure --noheadings --nosuffix --options \
  705.             --sort --partial --segments --separator --unbuffered --units \
  706.             --verbose --version' -- "$cur" ) )
  707.     else
  708.         _logicalvolumes
  709.     fi
  710. }
  711. complete -F _lvs lvs
  712.  
  713. _lvdisplay()
  714. {
  715.     local cur prev
  716.  
  717.     COMPREPLY=()
  718.     _get_comp_words_by_ref cur prev
  719.  
  720.     case $prev in
  721.         --units)
  722.             _units
  723.             return 0
  724.             ;;
  725.     esac
  726.  
  727.     if [[ "$cur" == -* ]]; then
  728.         COMPREPLY=( $( compgen -W '--colon --columns --units \
  729.             --partial --maps --verbose --debug --help --version' -- "$cur" ) )
  730.     else
  731.         _logicalvolumes
  732.     fi
  733. }
  734. complete -F _lvdisplay lvdisplay
  735.  
  736. _lvchange()
  737. {
  738.     local cur prev
  739.  
  740.     COMPREPLY=()
  741.     _get_comp_words_by_ref cur prev
  742.  
  743.     case $prev in
  744.         -a|-A|-C|-M|--available|--autobackup|--continguous|--persistent)
  745.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  746.             return 0
  747.             ;;
  748.         -p|--permission)
  749.             COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) )
  750.             return 0
  751.             ;;
  752.     esac
  753.  
  754.     if [[ "$cur" == -* ]]; then
  755.         COMPREPLY=( $( compgen -W '--autobackup --available \
  756.             --addtag --alloc --contiguous --debug --deltag \
  757.             --force --help --ignorelockingfailure \
  758.             --persistent --major --minor --partial \
  759.             --permission --readahead --refresh --test \
  760.             --verbose --version' -- "$cur" ) )
  761.     else
  762.         _logicalvolumes
  763.     fi
  764. }
  765. complete -F _lvchange lvchange
  766.  
  767. _lvcreate()
  768. {
  769.     local cur prev
  770.  
  771.     COMPREPLY=()
  772.     _get_comp_words_by_ref cur prev
  773.  
  774.     case $prev in
  775.         -A|-C|-M|-Z|--autobackup|--continguous|--persistent|--zero)
  776.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  777.             return 0
  778.             ;;
  779.         -L|--size)
  780.             _sizes
  781.             return 0
  782.             ;;
  783.         -p|--permission)
  784.             COMPREPLY=( $( compgen -W 'r rw' -- "$cur" ) )
  785.             return 0
  786.             ;;
  787.         -n|--name)
  788.             _logicalvolumes
  789.             return 0
  790.             ;;
  791.     esac
  792.  
  793.     if [[ "$cur" == -* ]]; then
  794.         COMPREPLY=( $( compgen -W '--autobackup --addtag --alloc \
  795.             --contiguous --debug --help --stripes \
  796.             --stripesize --extents --size --persistent \
  797.             --major --minor --name --permission \
  798.             --readahead --test --type --verbose --zero \
  799.             --version' -- "$cur" ) )
  800.     else
  801.         _args
  802.         if [ $args -eq 0 ]; then
  803.             _volumegroups
  804.         else
  805.             _physicalvolumes
  806.         fi
  807.     fi
  808. }
  809. complete -F _lvcreate lvcreate
  810.  
  811. _lvremove()
  812. {
  813.     local cur prev
  814.  
  815.     COMPREPLY=()
  816.     _get_comp_words_by_ref cur prev
  817.  
  818.     case $prev in
  819.         -A|--autobackup)
  820.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  821.             return 0
  822.             ;;
  823.     esac
  824.  
  825.     if [[ "$cur" == -* ]]; then
  826.         COMPREPLY=( $( compgen -W '--autobackup --debug \
  827.             --force --help --test --verbose --version' -- "$cur" ) )
  828.     else
  829.         _logicalvolumes
  830.     fi
  831. }
  832. complete -F _lvremove lvremove
  833.  
  834. _lvrename()
  835. {
  836.     local cur prev
  837.  
  838.     COMPREPLY=()
  839.     _get_comp_words_by_ref cur prev
  840.  
  841.     case $prev in
  842.         -A|--autobackup)
  843.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  844.             return 0
  845.             ;;
  846.     esac
  847.  
  848.     if [[ "$cur" == -* ]]; then
  849.         COMPREPLY=( $( compgen -W '--autobackup --debug \
  850.             --help --test --verbose --version' -- "$cur" ) )
  851.     else
  852.         _logicalvolumes
  853.     fi
  854. }
  855. complete -F _lvrename lvrename
  856.  
  857. _lvreduce()
  858. {
  859.     local cur prev
  860.  
  861.     COMPREPLY=()
  862.     _get_comp_words_by_ref cur prev
  863.  
  864.     case $prev in
  865.         -A|--autobackup)
  866.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  867.             return 0
  868.             ;;
  869.         -L|--size)
  870.             _sizes
  871.             return 0
  872.             ;;
  873.     esac
  874.  
  875.     if [[ "$cur" == -* ]]; then
  876.         COMPREPLY=( $( compgen -W '--autobackup \
  877.             --debug --force --help --extents \
  878.             --size --nofsck --resizefs --test --verbose --version' -- "$cur" ) )
  879.     else
  880.         _logicalvolumes
  881.     fi
  882. }
  883. complete -F _lvreduce lvreduce
  884.  
  885. _lvresize()
  886. {
  887.     local cur prev
  888.  
  889.     COMPREPLY=()
  890.     _get_comp_words_by_ref cur prev
  891.  
  892.     case $prev in
  893.         -A|--autobackup)
  894.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  895.             return 0
  896.             ;;
  897.         -L|--size)
  898.             _sizes
  899.             return 0
  900.             ;;
  901.     esac
  902.  
  903.     if [[ "$cur" == -* ]]; then
  904.         COMPREPLY=( $( compgen -W '--autobackup --alloc \
  905.             --debug --help --stripes --stripesize \
  906.             --extents --size --nofsck --resizefs \
  907.             --test --type --verbose --version' -- "$cur" ) )
  908.     else
  909.         _args
  910.         if [ $args -eq 0 ]; then
  911.             _logicalvolumes
  912.         else
  913.             _physicalvolumes
  914.         fi
  915.     fi
  916. }
  917. complete -F _lvresize lvresize
  918.  
  919. _lvextend()
  920. {
  921.     local cur prev
  922.  
  923.     COMPREPLY=()
  924.     _get_comp_words_by_ref cur prev
  925.  
  926.     case $prev in
  927.         -A|--autobackup)
  928.             COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
  929.             return 0
  930.             ;;
  931.         -L|--size)
  932.             _sizes
  933.             return 0
  934.             ;;
  935.     esac
  936.  
  937.     if [[ "$cur" == -* ]]; then
  938.         COMPREPLY=( $( compgen -W '--autobackup --alloc \
  939.             --debug --help --stripes --stripesize \
  940.             --extents --size --nofsck --resizefs \
  941.             --test --type --verbose --version' -- "$cur" ) )
  942.     else
  943.         _args
  944.         if [ $args -eq 0 ]; then
  945.             _logicalvolumes
  946.         else
  947.             _physicalvolumes
  948.         fi
  949.     fi
  950. }
  951. complete -F _lvextend lvextend
  952.  
  953. _lvm()
  954. {
  955.     local cur
  956.  
  957.     COMPREPLY=()
  958.     _get_comp_words_by_ref cur
  959.  
  960.     if [ $COMP_CWORD -eq 1 ]; then
  961.         COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \
  962.             lvcreate lvdisplay lvextend lvmchange \
  963.             lvmdiskscan lvmsadc lvmsar lvreduce \
  964.             lvremove lvrename lvresize lvs lvscan \
  965.             pvchange pvcreate pvdata pvdisplay pvmove \
  966.             pvremove pvresize pvs pvscan vgcfgbackup \
  967.             vgcfgrestore vgchange vgck vgconvert \
  968.             vgcreate vgdisplay vgexport vgextend \
  969.             vgimport vgmerge vgmknodes vgreduce \
  970.             vgremove vgrename vgs vgscan vgsplit \
  971.             version' -- "$cur" ) )
  972.     else
  973.         case ${COMP_WORDS[1]} in
  974.             pvchange)
  975.                 _pvchange
  976.                 ;;
  977.             pvcreate)
  978.                 _pvcreate
  979.                 ;;
  980.             pvdisplay)
  981.                 _pvdisplay
  982.                 ;;
  983.             pvmove)
  984.                 _pvmove
  985.                 ;;
  986.             pvremove)
  987.                 _pvremove
  988.                 ;;
  989.             pvresize)
  990.                 _pvresize
  991.                 ;;
  992.             pvs)
  993.                 _pvs
  994.                 ;;
  995.             pvscan)
  996.                 _pvscan
  997.                 ;;
  998.             vgcfgbackup)
  999.                 _vgcfgbackup
  1000.                 ;;
  1001.             vgcfgrestore)
  1002.                 _vgcfgrestore
  1003.                 ;;
  1004.             vgchange)
  1005.                 _vgchange
  1006.                 ;;
  1007.             vgck)
  1008.                 _vgck
  1009.                 ;;
  1010.             vgconvert)
  1011.                 _vgconvert
  1012.                 ;;
  1013.             vgcreate)
  1014.                 _vgcreate
  1015.                 ;;
  1016.             vgdisplay)
  1017.                 _vgdisplay
  1018.                 ;;
  1019.             vgexport)
  1020.                 _vgexport
  1021.                 ;;
  1022.             vgextend)
  1023.                 _vgextend
  1024.                 ;;
  1025.             vgimport)
  1026.                 _vgimport
  1027.                 ;;
  1028.             vgmerge)
  1029.                 _vgmerge
  1030.                 ;;
  1031.             vgmknodes)
  1032.                 _vgmknodes
  1033.                 ;;
  1034.             vgreduce)
  1035.                 _vgreduce
  1036.                 ;;
  1037.             vgremove)
  1038.                 _vgremove
  1039.                 ;;
  1040.             vgrename)
  1041.                 _vgrename
  1042.                 ;;
  1043.             vgs)
  1044.                 _vgs
  1045.                 ;;
  1046.             vgscan)
  1047.                 _vgscan
  1048.                 ;;
  1049.             vgsplit)
  1050.                 _vgsplit
  1051.                 ;;
  1052.             lvchange)
  1053.                 _lvchange
  1054.                 ;;
  1055.             lvcreate)
  1056.                 _lvcreate
  1057.                 ;;
  1058.             lvdisplay)
  1059.                 _lvdisplay
  1060.                 ;;
  1061.             lvextend)
  1062.                 _lvextend
  1063.                 ;;
  1064.             lvreduce)
  1065.                 _lvreduce
  1066.                 ;;
  1067.             lvremove)
  1068.                 _lvremove
  1069.                 ;;
  1070.             lvrename)
  1071.                 _lvrename
  1072.                 ;;
  1073.             lvresize)
  1074.                 _lvresize
  1075.                 ;;
  1076.             lvs)
  1077.                 _lvs
  1078.                 ;;
  1079.             lvscan)
  1080.                 _lvscan
  1081.                 ;;
  1082.         esac
  1083.     fi
  1084. }
  1085. complete -F _lvm lvm
  1086. }
  1087.  
  1088. # Local variables:
  1089. # mode: shell-script
  1090. # sh-basic-offset: 4
  1091. # sh-indent-comment: t
  1092. # indent-tabs-mode: nil
  1093. # End:
  1094. # ex: ts=4 sw=4 et filetype=sh
  1095.